package com.ttg.web.dao.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.ttg.common.enums.TagDataSourceEnum;
import com.ttg.model.po.TagInfoPO;
import com.ttg.model.pojo.TagInfo;
import com.ttg.model.pojo.TblTagInfo;
import com.ttg.model.mapper.TblTagInfoMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ttg.web.dao.TblTagInfoDao;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Objects;

/**
 * (TblTagInfo) daoImpl
 *
 * @author chenyou
 * @datetime 2025-10-20 17:43:46
 */
@Service
public class TblTagInfoDaoImpl extends ServiceImpl<TblTagInfoMapper, TblTagInfo> implements TblTagInfoDao {


    @Override
    public List<TblTagInfo> getTaglistByParam(TagInfoPO po) {
        LambdaQueryWrapper<TblTagInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(Objects.nonNull(po.getTagDataSource()),TblTagInfo::getTagDataSource,po.getTagDataSource());
        lambdaQueryWrapper.eq(Objects.nonNull(po.getTagStatus()),TblTagInfo::getTagStatus,po.getTagStatus());
        lambdaQueryWrapper.eq(Objects.nonNull(po.getUpdateType()),TblTagInfo::getUpdateType,po.getUpdateType());
        return list(lambdaQueryWrapper);
    }

    @Override
    public List<TblTagInfo> getAllByTypeAndStatus(TagDataSourceEnum type) {
        LambdaQueryWrapper<TblTagInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(TblTagInfo::getTagDataSource,type.getValue());
        lambdaQueryWrapper.eq(TblTagInfo::getTagStatus,0);
        return list(lambdaQueryWrapper);
    }
}

